package com.xzx.car_accessories.service.impl;

import com.xzx.car_accessories.dao.impl.CarAccessoryDaoImpl;
import com.xzx.car_accessories.dao.impl.InventoryDaoImpl;
import com.xzx.car_accessories.domain.CarAccessory;
import com.xzx.car_accessories.service.CarAccessoriesManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CarAccessoriesManageServiceImpl implements CarAccessoriesManageService {

    @Autowired
    private CarAccessoryDaoImpl carAccessoryDaoImpl;

    @Autowired
    private InventoryDaoImpl inventoryDaoImpl;

    @Override
    public int add_accessory(CarAccessory carAccessory) {
        inventoryDaoImpl.init_inventory(carAccessory.getCid());
        return carAccessoryDaoImpl.add_accessory(carAccessory);
    }

    @Override
    public List<CarAccessory> get_all_accessories()
    {
        return carAccessoryDaoImpl.get_all_accessories();
    }

    @Override
    public List<CarAccessory> get_diff_accessory(Map<String, Object> query_map)
    {
        return carAccessoryDaoImpl.get_diff_accessory(query_map);
    }

    @Override
    public int del_accessory(String cid)
    {
        return carAccessoryDaoImpl.del_accessory(cid);
    }

    @Override
    public int update_accessory(CarAccessory carAccessory)
    {
        return carAccessoryDaoImpl.update_accessory(carAccessory);
    }

    @Override
    public List<CarAccessory> findpage_accessory(int pageNum,  int pageSize)
    {
        return carAccessoryDaoImpl.findpage_accessory(pageNum, pageSize);
    }

    @Override
    public List<CarAccessory> search_accessory(String searchWord)
    {
        return carAccessoryDaoImpl.search_accessory(searchWord);
    }

    @Override
    public List<CarAccessory> search_findpage_accessory(int pageNum, int pageSize, String searchWord)
    {
        return carAccessoryDaoImpl.search_findpage_accessory(pageNum, pageSize, searchWord);
    }

    @Override
    public int del_any_accessory(Map<String, Object> map)
    {
        return carAccessoryDaoImpl.del_any_accessory(map);
    }

    @Override
    public List<Map<String, String>> groupCategory()
    {
        return carAccessoryDaoImpl.groupCategory();
    }

    @Override
    public List<Map<String, String>> groupManufacturer()
    {
        return carAccessoryDaoImpl.groupManufacturer();
    }
}
